package com.lookme.lmtool.cracker.filter.edge;

import com.jhlabs.image.DoGFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_EDGE,name="高斯差值-边缘检测",filterClass = DoGFilter.class)
public class FilterDoG extends AbstractFilter {

    @XStreamAsAttribute
    @ParamAnnotation(name = "半径1", desc = "高斯半径1",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.1,majorTickUnit = 30,minorTickCount = 5)
    float radius1=1;
    @XStreamAsAttribute
    @ParamAnnotation(name = "半径2", desc = "高斯半径2",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.1,majorTickUnit = 30,minorTickCount = 5)
    float radius2=1;
    @XStreamAsAttribute
    @ParamAnnotation(name = "标准化", desc = "标准化",inputType = ParamAnnotation.InputType.Radio,width = 60)
    boolean normalize=true;
    @XStreamAsAttribute
    @ParamAnnotation(name = "反转", desc = "反转",inputType = ParamAnnotation.InputType.Radio,width = 60)
    boolean invert=false;

    @Override
    public BufferedImageOp getFilter() {
        DoGFilter filter= new DoGFilter();
        filter.setRadius1(radius1);
        filter.setRadius2(radius2);
        filter.setNormalize(normalize);
        filter.setInvert(invert);
        return filter;
    }

}
